package cn.wolfcode.crm.query;

import com.alibaba.druid.util.StringUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
public class ClientObjectQuery extends ObjectQuery {

    private String keyword;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;
    private String searchManagerRealname;
    private String sort;
    private String order;


    public String getKeyword() {
        if (keyword != null && "".equals(keyword.trim())) {
            return null;
        }
        return keyword;
    }

    public String getSearchManagerRealname() {
        if (searchManagerRealname != null && "".equals(searchManagerRealname.trim())) {
            return null;
        }
        return searchManagerRealname;
    }

    public String getSort() {
        return StringUtils.isEmpty(sort) ? null : sort;
    }

    public String getOrder() {
        return StringUtils.isEmpty(order) ? "" : order;
    }

}
